package com.example.lenovo.recyclerview_lxy;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.example.lenovo.recyclerview_lxy.adapter.mainAdapter;
import com.example.lenovo.recyclerview_lxy.bean.RefreshData;
import com.example.lenovo.recyclerview_lxy.layoutmanager.FullyLinearLayoutManager;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private RecyclerView mRv_recyclerview;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        initListener();
        initData();
    }
    private void initData() {
        List<RefreshData> listdata=new ArrayList<RefreshData>();
        for(int x=0;x<20;x++)
        {
            RefreshData cd=new RefreshData();
//                            cd.setHead_img("nick_name"+x);
            cd.setPhone("155"+x);
            cd.setNick_name("nick_name"+x);
            cd.setSex(x);
            listdata.add(cd);
        }

        mainAdapter mAdapter = new mainAdapter(this,listdata);

        FullyLinearLayoutManager layoutManager = new FullyLinearLayoutManager(this);
        layoutManager.setOrientation(GridLayoutManager.VERTICAL);
        mRv_recyclerview.setLayoutManager(layoutManager);

        mRv_recyclerview.setAdapter(mAdapter);
    }
    private void initListener() {
    }

    private void initView() {
        mRv_recyclerview = (RecyclerView) findViewById(R.id.rv_recyclerview);
        
    }
}
